/**
 * Copyright (C) 2013 Daniel Gee.
 * See LICENSE.txt for more details.
 */
package com.rl.dungeon;

import java.awt.Color;

import com.rl.gui.Appearance;

/**
 * Represents a specific type of terrain tile that a location can have.
 * 
 * @author Daniel Gee
 */
public enum DungeonTerrain
{
	/**
	 * Open space that you can walk on. A natural cave floor, flagstone, wood, etc.
	 */
	Floor('.', Color.darkGray),
	/**
	 * Tall grass that blocks vision but doesn't block movement.
	 */
	Grass('"', Color.green),
	/**
	 * Pools of lava that block movement but not vision.
	 */
	Lava('~', new Color(240, 96, 0)),
	/**
	 * The stairs deeper into the dungeon.
	 */
	StairsDown('>', Color.yellow),
	/**
	 * The stairs up out of the dungeon.
	 */
	StairsUp('<', Color.yellow),
	/**
	 * Used for spaces outside of the map.
	 */
	Void(' ', Color.black),
	/**
	 * Either a natural cave wall or a constructed brick wall of some sort.
	 */
	Wall('#', new Color(150, 100, 20));

	/**
	 * The appearance of this tile type.
	 */
	public final Appearance appearance;

	/**
	 * @param glyph
	 *            the glyph of this tile type.
	 * @param color
	 *            the color of this tile type.
	 */
	private DungeonTerrain(char glyph, Color color)
	{
		this.appearance = new Appearance(glyph, color);
	}

	/**
	 * @return if this terrain blocks normal vision or not.
	 */
	public boolean isVisionBlocking()
	{
		if (this == Wall || this == Void || this == Grass)
		{
			return true;
		}
		return false;
	}

	/**
	 * @return if this terrain can be walked across or not.
	 */
	public boolean isWalkable()
	{
		if (this == Wall || this == Void || this == Lava)
		{
			return false;
		}
		return true;
	}
}
